package cn.edu.sicau.databasepp.entity;

import javax.persistence.*;
import java.util.Objects;

@Entity
@Table(name = "room_table", schema = "sqlexcise", catalog = "")
public class RoomTableEntity
{
    private long roomId;
    private String roomNumber;
    private Integer volume;

    @Id
    @Column(name = "room_id", nullable = false)
    public long getRoomId()
    {
        return roomId;
    }

    public void setRoomId(long roomId)
    {
        this.roomId = roomId;
    }

    @Basic
    @Column(name = "room_number", nullable = true, length = 16)
    public String getRoomNumber()
    {
        return roomNumber;
    }

    public void setRoomNumber(String roomNumber)
    {
        this.roomNumber = roomNumber;
    }

    @Basic
    @Column(name = "volume", nullable = true)
    public Integer getVolume()
    {
        return volume;
    }

    public void setVolume(Integer volume)
    {
        this.volume = volume;
    }

    @Override
    public boolean equals(Object o)
    {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        RoomTableEntity that = (RoomTableEntity) o;
        return roomId == that.roomId &&
                Objects.equals(roomNumber, that.roomNumber) &&
                Objects.equals(volume, that.volume);
    }

    @Override
    public int hashCode()
    {
        return Objects.hash(roomId, roomNumber, volume);
    }
}
